package com.dream.controller;

import com.dream.annotation.OnlyQuery;
import com.dream.model.SubmitBody;
import com.dream.wrap.R;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @OnlyQuery
    @GetMapping("/get")
    public R get() {
        return R.ok().setData("获取接口成功");
    }

    @PostMapping("/submitParam")
    public R submitTest(@RequestParam("name") String name) {
        System.out.println(name);
        return R.ok().setData("param方式提交成功");
    }

    @PostMapping("/submitBody")
    public R submitBody(@RequestBody SubmitBody body) {
        System.out.println(body);
        return R.ok().setData("body方式提交成功");
    }
}